package com.cate.controller.user;

import com.cate.pojo.entity.Dish;
import com.cate.result.RestResponse;
import com.cate.service.DishService;
import com.cate.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @CreateTime: 2023/8/1
 * @Author: <==lhd==>
 * @Description:
 */
@RestController("UserDishController")
@Slf4j
@RequestMapping("/user/dish")
@Api(tags = "用户端菜品接口")
public class DishController {

    @Autowired
    private DishService dishService;

    @GetMapping("/list")
    @ApiOperation("获得菜品列表")
    public RestResponse<List<Dish>> getListByCategoryId(Long categoryId){
        final List<Dish> list = dishService.list(categoryId);
        return ResultUtil.success(list);
    }
}
